const express = require('express')
const aRouter = express.Router();
const verifyFn = require('../middlewares/verify');

aRouter.get('/loginPost',(req,res)=>{
    // 6.1 将数据存入session的自定义属性内 - req.session.name = value
    req.session.username ='小李',
    req.session.id = '123';
    // 6.2 返回响应
    res.send('ok');
})

// 8. 配置get路由 - 删除session - 退出登录
aRouter.get('/logout',verifyFn,(req,res)=>{
  req.session.destroy(()=>{
    res.send('退出成功');
  })
})

module.exports = aRouter;